$.fn.check = function(mode){
   //var mode = mode || 'on'; //default
    return this.each(function(){
        switch(mode){
            case 'on':
                this.checked = true;
                break;
            case 'off':
                this.checked = false;
                break;
            case 'toggle':
              this.checked = !this.checked;
                break;
				//default :
				//mode = 'on';
        }
    });
};

$(document).ready(function(){
	$("#type").change(function(){
		var type = $("#type").val();
		if(type =='text') {
			$("#ismustselect").css('display','');
			$("#trOptions").css('display','none');
			$("#default").css('display','');
		} else if (type == 'select') {
			$("#ismustselect").css('display','none');
			$("#trOptions").css('display','');
			$("#default").css('display','none');
		} else if (type == 'textarea') {
			$("#ismustselect").css('display','');
			$("#trOptions").css('display','none');
			$("#default").cols;
		} else if (type == 'radio') {
			$("#ismustselect").css('display','none');
			$("#trOptions").css('display','');
			$("#default").css('display','none');
		} else if (type == 'checkbox') {
			$("#ismustselect").css('display','none');
			$("#trOptions").css('display','');
			$("#default").css('display','none');
		} else if (type == 'password') {
			$("#ismustselect").css('display','');
			$("#default").css('display','');
		} else if (type == 'file') {
			$("#ismustselect").css('display','none');
			$("#default").css('display','none');
		} else {
			$("#ismustselect").css('display','none');
			$("#trOptions").css('display','none');
		}
	});
});

function showjs(fid) {
			if($("#jshtml_" + fid).css('display') == 'none') {
				$("#jshtml_" + fid).css("display","");
				$("#jshtml_" + fid).css("color","red");
			} else {
				$("#jshtml_" + fid).css("display","none");
			}
}
$(function(){
$("#checkall1").click(function(){
$("input[@name='del[]']").check('on');
})
$("#checktog1").click(function(){
$("input[@name='del[]']").check('toggle')
})
});

function changeform(action,fid) {
	$(document).ready(function(){
		$("#wait").html("正在执行操作...");
		$.ajax({
			url:"form.php",
				type: "post",
				datatype : "html",
				data : "action=" + action + "&fid=" + fid,
				success : function(msg) {
				$("#" + action + "_" + fid).html(msg);
				$("#wait").html("");
			}
		});
	});
}